//
//  PageScrollView.m
//  XCC
//
//  Created by 红沙尘 on 2019/6/20.
//  Copyright © 2019 红沙尘. All rights reserved.
//

#import "PageScrollView.h"

@implementation PageScrollView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.delegate = self;
    self.backgroundColor = UIColor.yellowColor;
    
    v = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 296, 77)];
    v.pagingEnabled = YES;
    v.clipsToBounds = NO;
    v.backgroundColor = UIColor.redColor;
    [self addSubview:v];

    for (int i = 0; i < 5; i ++) {
        UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake((296 + 0)*i + 9, -3, 296, 84)];
        iv.image = [UIImage imageNamed:@"TTTTT"];
        [v addSubview:iv];
        v.contentSize = CGSizeMake(CGRectGetMaxX(iv.frame), 77);
    }
    
    self.contentSize = CGSizeMake(UIScreen.mainScreen.bounds.size.width*5, 77);
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    NSLog(@"%f",scrollView.contentOffset.x);
}

@end
